package com.biz.primus.auth.feign;

import com.biz.primus.base.enums.CommonStatus;
import com.biz.primus.model.sso.auth.vo.RoleVo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by younger on 17/11/6.
 */
@FeignClient(qualifier = "roleFeignClient", name = "service-sso-auth", fallback = RoleDegradedFeignClient.class)
public interface RoleFeignClient {

    /**
     * 得到有效果的角色
     */
    @PostMapping("soa/roleService/findByStatus")
    public List<RoleVo> findByStatus(@RequestBody CommonStatus status);

    /**
     * 保存更新角色
     */
    @PostMapping("soa/roleService/addOrUpdate")
    public void addOrUpdate(@RequestBody RoleVo roleVo);

    /**
     * 获取一个角色
     */
    @PostMapping("soa/roleService/getRole")
    public RoleVo getRole(@RequestParam(name = "id") Long id);

    /**
     * 删除一个角色
     */
    @PostMapping("soa/roleService/delete")
    public Boolean delete(@RequestParam(name = "id")Long id);

    /**
     * 判断角色是否存在
     */
    @PostMapping("soa/roleService/isExist")
    public Boolean isExist(@RequestBody RoleVo roleVo);
}
